fix: Sph profile inverse transform name-check asymmetry - #557
Merged
Conversation
This was referenced Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EllProfile.transformed_from_reference_frame_grid_fromcheckedself.__class__.__name__.startswith("Sph")while its mirrortransformed_to_reference_frame_grid_fromchecksendswith("Sph"). Spherical profiles are suffix-named (IsothermalSph,NFWSph, ...) and no concrete class starts with "Sph", so the inverse transform's spherical branch never fired — every spherical profile took the elliptical rotation path. Numerically benign today (spherical profiles haveangle = 0, an exact identity rotation), but the transforms were asymmetric and the inverse did wasted rotation work on the hot path. Fixed toendswith("Sph"); a stack-wide sweep (PyAutoGalaxy/PyAutoLens/PyAutoArray/PyAutoFit) confirms this was the only occurrence of the pattern.Known residual:
IsothermalSphMLR(name ends "MLR") is missed by both name checks and continues down the elliptical path — numerically correct, flagged here rather than inventing a new dispatch mechanism for one class.Closes #555.
API Changes
None — internal changes only.
Test Plan
test__sph_named_profile__both_transforms_use_translation_only_pathasserts (via mock) that neither transform calls the rotation helper for a suffix-named spherical profile. Control-verified: fails on the unfixed source, passes with the fix.test_autogalaxy/profiles: 619 passed.test_autogalaxysuite run at ship time (counts in PR checks / ship log).Full API Changes (for automation & release notes)
None — internal changes only. No public symbols added, removed, renamed, or changed in signature; numerical results unchanged (the previously-taken elliptical path applied an exact identity rotation).
Ship gate note
Shipped with explicit human authorization under Heart RED — reason
release validation FAILED (stage integrate), an unrelated in-flight release-validation run; this change was uncommitted at the time of that verdict. Merge remains a separate human decision.Generated by the PyAutoLabs agent workflow.